﻿@using SatelliteSite.BloggingModule.Models 
@model BlogPublishModel
@{
    ViewData["Title"] = "Publish blog post";
}

<h2 class="mt-2">@ViewData["Title"]</h2>

<link rel="stylesheet" href="/lib/editor-md/css/editormd.min.css" />
<script src="/lib/editor-md/editormd.min.js"></script>

<form method="post" class="setting-form-group">
    <div asp-validation-summary="All"></div>

    <div class="form-group">
        <label class="font-weight-bold" asp-for="Title"></label>
        <input class="form-control" asp-for="Title" />
    </div>

    <div class="form-group" asp-in-roles="Administrator">
        <label class="font-weight-bold">Activity</label>
        <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" asp-for="ShowOnHomePage" id="isactive">
            <label class="custom-control-label" for="isactive">Show on the Home Page</label>
        </div>
    </div>

    <div class="form-group">
        <label class="font-weight-bold">Content</label>
        <div style="height:640px"><div id="editormd"><textarea style="display:none;" asp-for="Content"></textarea></div></div>
    </div>

    <script type="text/javascript">
        $(function () {
            var editor = editormd({
                id: "editormd",
                path: "/lib/editor-md/lib/",
                tex: true,
                imageUpload: true,
                imageFormats: ["jpg", "jpeg", "gif", "png", "svg", "pdf"],
                imageUploadURL: "/api/static/images-upload?type=u&id=0",
            });

            editormd.katexURL = {
                js: "/lib/katex/katex.min",
                css: "/lib/katex/katex.min"
            };
        });
    </script>

    <div class="form-group mt-3">
        <button type="submit" class="btn btn-primary">Save</button>
    </div>
</form>

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}
